var nodeType = "node";
var layerType = "node-layer";
$(function() {
	$nodes = $("[" + nodeType + "]");
	$nodes.each(function(index) {
		$nodeHref = $(this).find("a:first");
		var nodeName = $(this).attr(nodeType);
		$nodLayer = $("[" + layerType + "='" + $(this).attr(nodeType) + "']");
		$(this).bind("mouseover", {
			node : $(this),
			nodeLayer : $nodLayer,
			nodeName : nodeName
		}, menuShow);
		$(this).bind("mouseout", {
			node : $(this),
			nodeLayer : $nodLayer
		}, menuHide);
	});
	$('#login').dialog({
		fixed : true,
		id : 'test1',
		content : 'url:login.htm',
		title : '登录或注册',
		width : 450,
		height : 210,
		skin : 'discuz',
		max : false,
		min : false

	});
});

function menuShow(e) {
	$node = e.data.node;
	$nodLayer = e.data.nodeLayer;
	var nodeName = e.data.nodeName;
	$nodLayer = $("[" + layerType + "='" + nodeName + "']");
	$node.addClass("current");
	$nodLayer.show();
}

function menuHide(e) {
	$node = e.data.node;
	$nodLayer = e.data.nodeLayer;
	if ($nodLayer.is(":visible")) {
		$node.removeClass("current");
		$nodLayer.hide();
		currentNode = $node;
		currentLayer = $nodLayer;
	}
}
